import { init } from 'snabbdom/src/package/init';
import { h } from 'snabbdom/src/package/h'; // helper function for creating vnodes
import { eventListenersModule  } from 'snabbdom/src/package/modules/eventlisteners';
import { styleModule  } from 'snabbdom/src/package/modules/style';

var patch = init([ // Init patch function with chosen modules
  styleModule, // makes it easy to toggle classes
  eventListenersModule,
])

const container = document.getElementById('root')
let vNode = h('div#app.cls',
  {
    style: {
      backgroundColor: 'red'
    },
    on: {
      click: () => {
        console.log('click');
      }
    }
  }, [
    'hello world',
    h('div', 'hello div'),
    h('p', 'hello p'),
  ]);

const oldDom = patch(container, vNode);